<link href="css/plugins/sweetalert/sweetalert.css" rel="stylesheet">
<script src="js/plugins/sweetalert/sweetalert.min.js"></script>
	  <!-- 全局js -->
    <script src="js/jquery.min.js?v=2.1.4"></script>
    <script src="js/bootstrap.min.js?v=3.3.6"></script>



    <!-- ECharts -->
    <script src="js/plugins/echarts/echarts-all.js"></script>

    <!-- 自定义js -->
    <script src="js/content.js?v=1.0.0"></script>


    <!-- ECharts demo data -->
    <script src="js/demo/echarts-demo.js"></script>
<?php
error_reporting(0);
header("Content-Type: text/html; charset=UTF-8");
$action=$_GET['action'];
	session_start();
		if(time() - $_SESSION['time'] >1800){
		unset($_SESSION['username']);
unset($_SESSION['passcode']);
unset($_SESSION['userflag']);
		unset($_SESSION['time']);
		
	}
if(isset($_SESSION['username']))
{

 if($action==appid){
$oldappid=$_POST['oldappid'];
$oldappsecret=$_POST['oldappsecret'];
$appid=$_POST['appid'];
$appsecret=$_POST['appsecret'];
$contents=file_get_contents('wx_config.php');
$contents= str_replace($oldappid,$appid,$contents);
$contents= str_replace($oldappsecret,$appsecret,$contents);
file_put_contents('wx_config.php',$contents);
 exit( ' <script>$(document).ready(function () { swal({title: 
	"修改成功！",
                    type: "success"
					
                }, function() {location.href=document.referrer;});
          
        });
    </script>');
}
 if($action==user){
$user=$_POST['user'];
$password=md5($_POST['password']);
if($_POST['password']==''){
 exit( ' <script>$(document).ready(function () { swal({title: 
	"密码不能为空哦！",
                    type: "error"
					
                }, function() {location.href=document.referrer;});
          
        });
    </script>');
}
 else{
$con = mysql_connect ('localhost','root','root');
            @mysql_select_db('jianli', $con); 
			mysql_query("UPDATE  `jianli`.`users` SET  `username` =  '$user' , `password`= '$password'");
exit( ' <script>$(document).ready(function () { swal({title: 
	"修改成功！",
                    type: "success"
					
                }, function() {location.href=document.referrer;;});
          
        });
    </script>');}
}

}else{
 exit( ' <script>$(document).ready(function () { swal({title: 
	"抱歉，你还未登录哦！",
                    type: "error"
					
                }, function() {location.href="login.php";});
          
        });
    </script>');
}

?>